home *** CD-ROM | disk | FTP | other *** search
-
-
- SAVING AND LOADING THE COMMODORE 128
- GRAPHIC BIT MAP
- by
- Morton A. Kevelson
-
-
- COMMODORE MICROCOMPUTERS MAGAZINE
- July/August, 1986
-
-
- **************************************
- NOTE: Because this program is written
- for the Commodore 128, it cannot be
- run like other programs in LOADSTAR.
- To run this program, press your RESET
- button. This will automatically
- display a menu of all C-128 programs
- in this issue. Choose the program you
- wish to run from this menu.
- **************************************
-
-
- The C-128's BASIC 7.0 has built-in
-
- commands that allow you to create
-
- both high-res and multicolor graphics.
-
- But because each step in drawing must
-
- be specified by a BASIC command,
-
- drawing a complex image will take up
-
- a great deal of time as well as a
-
- great deal of program space.
-
-
- The solution to this problem is to
-
- save your graphic image to disk as a
-
- binary program file. This way, only a
-
- few BASIC commands are required to
-
- redisplay the image, reducing program
-
- overhead. (All that is required in
-
- the program is the image file name,
-
- and even it may also be saved to
-
- disk).
-
-
- In addition to saving space, this
-
- solution also saves time-- if you
-
- have a 1571 disk drive, it takes only
-
- about four seconds to load a high-res
-
- graphic, only six seconds to load a
-
- multicolor graphic.
-
-
- Also, working directly with the
-
- Commodore 128's graphic bit map lets
-
- you import images from existing
-
- Commodore graphics packages. Once
-
- you know the format of these images,
-
- you can easily convert them into
-
- usable form with the BSAVE or BLOAD
-
- commands, or with the 128's built-in
-
- machine language monitor.
-
-
- BAD NEWS/GOOD NEWS.....
-
-
- While saving and loading a high-res
-
- bit map is relatively straightforward,
-
- doing the same to a multicolor
-
- bit-mapped image is another story.
-
- Fortunately, Morton Kevelson's two
-
- programs perform all of the activities
-
- required to save and load both kinds
-
- of images. These programs can be
-
- added to your own programs as
-
- subroutines.
-
-
- The save routine expects the image
-
- to be in either the appropriate
-
- graphic mode or split-screen mode when
-
- it's called; exiting the subroutine
-
- restores this mode. If you attempt to
-
- enter while in text display, you will
-
- simply return to the calling program.
-
-
- The save routine will check the
-
- current graphic mode and prompt you
-
- to enter an image file name for the
-
- bit map. For a high-res image, the
-
- bit map and screen memory are saved
-
- as a single file. A saved multicolor
-
- image uses the same block of memory
-
- plus a separate file containing color
-
- memory from $D800. (A color memory
-
- file will have a ".CM" suffix-- even
-
- if the file name must be truncated to
-
- thirteen characters).
-
-
- Kevelson's programs make use of
-
- some of the extra bytes between the
-
- screen memory and the bit map. He
-
- stores the screen border color in
-
- 8169, the graphic display mode in
-
- 8170.
-
-
- The loader subroutine first assumes
-
- that you are working with a high-res
-
- picture. After the screen memory and
-
- bit map are loaded, the loader
-
- subroutine checks location 8170 and
-
- switches modes if necessary. Color
-
- memory is then loaded. Note that the
-
- background and border color values
-
- are the VIC chip values, which are
-
- incremented by one for use with BASIC.
-
-
- NOTE: if you are converting
-
- Commodore bit maps to this format,
-
- you will find that not all graphic
-
- packages save the background and
-
- border colors-- some assume the
-
- background to be white or black. If
-
- you come across files of this type,
-
- you must modify the saved files or
-
- the load routine.
-
-
- FILES REQUIRED:
-
- BITMAP LOAD 128
- BITMAP SAVE 128
-
- -----------< end of text >------------
-